

export const apis = {
}

/**
 * 获取切片服务的端口
 * @param {*} tileServiceName
 * @returns 
 */
export const _getport = async (url: string) => {
    const authToken = window.localStorage.getItem('Authorization');
    const requestOptions = {
        headers: {
            ...(authToken ? { 'Authorization': authToken } : {}),
            
        },
        mode: "cors", // 用来决定是否允许跨域请求  

    };
    // @ts-ignore
    const res = await fetch(url, requestOptions);
    const jsonStr = await res.text();
    const json = JSON.parse(jsonStr);
    if (json.status == "ok") {
        return json.data.port as string;
    } else {
        console.error(json.status);
        return undefined
    }
}



